import http from '@/utils/http'

/**
 * 
 * @param {object} data   要传入的data中有skuId和count
 * 
 */

export const postMemberCart = (data) => {
    return http({
        url: '/member/cart',
        method: 'post',
        data
    })
}


/**
 * 
 * @returns  获取购物车列表
 */
export const getMemberCart = () => {
    return http({
        url: '/member/cart',

    })
}


// /member/cart/{id}
export const putMemberCart = (id,data) => {
    return http({
        url: `/member/cart/${id}`,
        method:'put',
        data

    })
}

// 购物车全选/取消全选

/**
 * 购物车全选/取消全选
 * @param {objcet} data  selected是否选中 ids  skuId集合[ skuId ]
 * 
 */


export const putMemberCartSelected = (data) => {
    return http({
        url: `/member/cart/selected`,
        method:'put',
        data

    })
}


/**
 * 
 * @param {object} data ids SKUID集合[ SKUID ]   clearAll 是否清空，默认否 clearInvalid 是否清空无效商品，默认否
 * @returns 
 */
export const deleteMemberCart = (data) => {
    return http({
        url: '/member/cart',
        method:'delete',
        data

    })
}



